package com.timoon.sample.web.product.panel;

import java.util.Arrays;
import java.util.List;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;

import com.timoon.component.panel.jqgrid.JqGridPanel;
import com.timoon.component.panel.jqgrid.JqGridService;
import com.timoon.component.panel.jqgrid.panel.DetailsPanel;
import com.timoon.sample.dao.model.Product;

/**
 *<p></p>
 *<p></p>
 *<p>Copyright:Copyright(c)2013</p>
 *<p>Company:timoon</p>
 *@author 付乐天
 *@version 1.0 */

public class ProductDetailPanel extends DetailsPanel {

	@SpringBean(name="com.timoon.webcomponent.utility.product.service.ProductService")
	private JqGridService service;
	
	private Product product;
	
	public ProductDetailPanel(String id,JqGridPanel mainPanel,String recordId) {
		super(id,mainPanel,recordId);
		// TODO Auto-generated constructor stub
		
		product=(Product) this.service.loadRecordById(recordId);
		
		renderPanel();
	}

	private void renderPanel() {
		// TODO Auto-generated method stub
		
		//基本信息
		renderBasicInfo();
	}

	private void renderBasicInfo() {
		// TODO Auto-generated method stub
		
		add(new Label("wk_id", new PropertyModel<>(product, "id")));
		add(new Label("wk_name", new PropertyModel<>(product, "name")));
		add(new Label("wk_market_price", new PropertyModel<>(product, "marketPrice")));
		add(new Label("wk_actrue_price", new PropertyModel<>(product, "actualPrice")));
		add(new Label("wk_rate", new PropertyModel<>(product, "rate")));
		add(new Label("wk_status", new PropertyModel<>(product, "status")));
		add(new Label("wk_sale_info", new PropertyModel<>(product, "saleInfo")));
		add(new Label("wk_service_info", new PropertyModel<>(product, "serviceInfo")));
	}

}
